<template>
	<view class="recharge-page">
		<u-navbar title="提现申请" :placeholder="true" :autoBack="true">
			<view class="u-nav-slot" slot="right">
				<text @click="goRecord">申请记录</text>
			</view>
		</u-navbar>
		<view class="content">
			<view class="head-tabs">
				<view :class="item.show == true?'activity-item':''" class="tabs-item" v-for="(item,index) in headList"
					:key="index" @click="cutTabs(index)">
					{{item.text}}
				</view>
			</view>
			<view v-show="type == 0">
				<view class="item">
					<view class="item-title">
						提现金额
					</view>
					<view class="item-text">
						<u-input type="number" placeholder="提现金额" border="none" v-model="money"></u-input>
					</view>
				</view>
				<view class="item" @click="show = true">
					<view class="item-title">
						提现账户
					</view>
					<view class="item-text">
						<u-input type="text" placeholder="选择提现账户" border="none" v-model="account" readonly></u-input>
					</view>
				</view>
				<view class="item">
					<view class="item-title">
						提现密码
					</view>
					<view class="item-text">
						<u-input type="password" placeholder="提现密码" border="none" v-model="password"></u-input>
					</view>
				</view>
				<view class="item">
					<view class="item-title">
						谷歌验证码
					</view>
					<view class="item-text">
						<u-input placeholder="谷歌验证码" border="none" v-model="code"></u-input>
					</view>
				</view>
				<view class="tips">
					余额出款收0.5%手续费(未达¥2 已¥2计算)
				</view>
			</view>
			<view v-show="type == 1">
				<view class="item">
					<view class="item-title">
						提现金额
					</view>
					<view class="item-text">
						<u-input type="number" placeholder="提现金额" border="none" v-model="money"></u-input>
					</view>
				</view>
				<view class="item">
					<view class="item-title">
						提现账户
					</view>
					<view class="item-text">
						<u-input @click="show = true" type="text" placeholder="选择提现账户" border="none" v-model="account"
							readonly></u-input>
					</view>
				</view>
				<view class="item">
					<view class="item-title">
						提现密码
					</view>
					<view class="item-text">
						<u-input type="password" placeholder="提现密码" border="none" v-model="password"></u-input>
					</view>
				</view>
				<view class="item">
					<view class="item-title">
						谷歌验证码
					</view>
					<view class="item-text">
						<u-input type="number" placeholder="谷歌验证码" border="none" v-model="code"></u-input>
					</view>
				</view>
				<view class="tips">
					红利出款不收手续费,最小提现金额为 ¥1000
				</view>
				
			</view>
			<view class="btn">
				<u-button shape="circle" color="#ff4e4e" size="large" type="primary" text="申请提现"></u-button>
			</view>
		</view>
		<u-picker :show="show" :columns="columns" @close="close" @confirm="confirm"></u-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				headList: [{
						text: '余额提现',
						show: true
					},
					{
						text: '红利提现',
						show: false
					},
				],
				type: 0,
				money: '',
				account: '',
				password: '',
				code: '',
				show: false,
				columns: [
					['中国', '美国', '日本']
				]
			}
		},
		methods: {
			cutTabs(index) {
				this.headList.map(item => {
					item.show = false
				})
				this.headList[index].show = true
				this.type = index
			},
			confirm(e) {
				this.account = e.value[0]
				this.show = false
				console.log(this.account)
			},
			close() {
				this.show = false
			},
			goRecord(){
				uni.navigateTo({
					url:'/pages/index/withdrawal/record'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.recharge-page {
		min-height: 100vh;
		background-image: url('../../../static/home/page-bg.png');
		background-repeat: no-repeat;
		background-size: 100% 100%;
		.u-nav-slot{
			font-size: 24rpx;
			color: #666;
		}
		.content {
			padding: 30rpx 50rpx;

			.head-tabs {
				width: 70%;
				display: flex;
				justify-content: space-between;
				background-color: #fff;
				margin: 0 auto;
				border-radius: 20rpx;
				font-size: 28rpx;
				margin-top: 30rpx;
			
				.tabs-item {
					width: 50%;
					color: #000;
					padding: 20rpx 30rpx;
					text-align: center;
				}
			
				.activity-item {
					background: #ff4e4e;
					border-radius: 20rpx;
					color: #fff;
				}
			}

			.item {
				display: flex;
				align-items: center;
				background-color: #fff;
				padding: 30rpx;
				border-radius: 20rpx;
				margin: 0 auto;
				margin-top: 50rpx;

				.item-title {
					width: 200rpx;
					font-size: 28rpx;
				}
			}

			.tips {
				color: #eee;
				font-size: 26rpx;
				margin-top: 30rpx;
				text-align: center;
			}

			.btn {
				margin-top: 50rpx;
			}
		}
	}
</style>